package pruebas;

import junit.framework.TestCase;
import modelo.auto.*;


public class TestCaja extends TestCase {
	Caja comp;
    final static double precio = Double.MAX_VALUE;
    final static double peso = 20;
    final static String nombre = "Caja";
    final static String tipo = "Veloz";
    final static double vidaUtil = 80;
    final static int tipocaja=1;
    final static int maxMarchas=7;
    final static double factAcel = 0.98;
    final static double factVel = 1.98;
 
    protected void setUp() throws Exception {
        comp= new Caja(nombre,tipo,precio,peso,factVel,factAcel,vidaUtil,tipocaja,maxMarchas); 
    }
 
    public void testSetMarcha(){
    	int esperado =0;
    	comp.setMarcha(0);
        assertEquals(esperado,comp.getMarcha());
    }
       
 
    public void testAumentarMarcha1(){ 
    	comp.setMarcha(0);
    	comp.aumentarMarcha();
    	comp.aumentarMarcha();
    	int esperado = 2;
    	assertEquals(esperado, comp.getMarcha());
    }
    
 
    public void testAumentarMarcha2(){ 
    		comp.setMarcha(0);
       		int max=comp.getMaxMarcha();
       		int tope=max+2;
    		int i=0;
    		for(i=0;i<tope;i++){
    			comp.aumentarMarcha();
    		}
    		i=comp.getMarcha();
    		assertEquals(i,max);
    }
 
 
    
    public void testDisminuirMarcha(){ //throws GearboxUnderflowException{
    	comp.setMarcha(maxMarchas);
    	int antes=comp.getMarcha();
    	comp.disminuirMarcha();
    	comp.disminuirMarcha();
    	comp.disminuirMarcha();
        int ahora=comp.getMarcha();
        assertTrue(antes>ahora);
    }
    
}

